<template>
  <div class="headwrap">
    <div class="home-head">
      <div class="logoimg">
        <img src="../../../assets/img/logo.png" alt="logo">
      </div>
      <div class="search" @click="$router.push('/search')">
      <van-icon name="search" size="18"/>
        <span>搜索严选商品</span>
      </div>
      <div class="denlu" v-show="!token" @click="$router.push('/login')">
      登录
    </div>
  </div>
  </div>
</template>

<script>
import { getToken } from '_utils'
export default {
  data () {
    return {
      token: getToken()
    }
  },
  activated () {
    if (this.$route.params.id === 1) {
      this.$router.go(0)
    }
  }
}
</script>

<style lang="scss" scoped>
.headwrap{
  position: fixed;
  left: 0;
  top: 0;
  background-color: white;
  height: 50px;
  width: 100%;
  z-index: 999;
  .home-head{
    margin: 10px;
    display: flex;
    flex-direction: row;
    justify-content: center;
    width: 95%;
    z-index: 999;
  .logoimg{
    margin-right: 5px;
    width: 70px;
    height: 28px;
    img{
      margin-top: 4px;
      width: 70px;
      height: 20px;
    }
  }
  .search{
    flex: 1;
    width: 50px;
    height: 28px;
    border-radius: 5px ;
    background-color: #EDEDED;
    display: flex;
    justify-content: first baseline;
    align-items: center;
    color: #666666;
    .van-icon-search{
      margin-left: 8px;
      margin-top: 4px;
    }
    span{
      text-align: center;
      font-size: 15px;
    }
  }
  .denlu{
    margin-left: 5px;
    width: 36px;
    height: 28px;
    line-height: 28px;
    text-align: center;
    border: 1px solid #dd1a21;
    border-radius: 6px;
    color: #dd1a21;
  }
}
}

</style>
